home *** CD-ROM | disk | FTP | other *** search
/ Aminet 1 (Walnut Creek) / Aminet - June 1993 [Walnut Creek].iso / aminet / hard / drivr / addreset.lha / AddReset.s < prev    next >
Text File  |  1992-02-08  |  1KB  |  80 lines

  1. ;AddReset By Niklas Sjöberg
  2.  
  3.         incdir    /include/
  4.         include    exec/execbase.i
  5.         include    exec/exec_lib.i
  6.         include exec/memory.i
  7.         include    "libraries/dos_lib.i"
  8.         include "libraries/dos.i"
  9.         
  10. Print        MACRO
  11.         lea    \1(PC),a1
  12.         lea    \1_end(PC),a2
  13.         suba.l    a1,a2
  14.         move.l    a1,d2            ;buf
  15.         move.l    a2,d3            ;len
  16.         CALLDOS    Output
  17.         move.l    d0,d1
  18.         CALLDOS    Write
  19.         ENDM
  20.  
  21.         lea    Dosname(PC),a1
  22.         moveq    #0,d0
  23.         CALLEXEC OpenLibrary
  24.         tst.l    d0
  25.         beq    error
  26.         move.l    d0,_DOSBase
  27.         
  28.         move.l    #end-start,d0
  29.         move.l    #MEMF_CHIP,d1    ;If PUBLIC it won't work
  30.         CALLEXEC AllocMem    ;
  31.         tst.l    d0        ;No mem
  32.         beq    error_res
  33.         move.l    d0,a1
  34.         move.l    a1,ColdCapture(a6) ;Patch us in reset
  35.         move.w    #end-start,d0    ;Len of our routine
  36.         lea    start,a0
  37. l1        move.b    (a0)+,(a1)+    ;Copy to reserved mem
  38.         dbf    d0,l1
  39.         
  40.         moveq    #0,d1
  41.         lea.l    SoftVer(a6),a0    ;Get base for chksum
  42.         move.w    #$16,d0
  43. l2        add.w    (a0)+,d1    ;Calc ShkSum
  44.         dbf    d0,l2
  45.         not.w    d1
  46.         move.w    d1,ChkSum(a6)    
  47.         Print    res
  48. error        moveq    #0,d0
  49.         rts        
  50.  
  51. error_res    Print    no_res
  52.         rts
  53.         
  54. start
  55.         move.w    #$ffff,d0
  56. fladder
  57.         move.w    #$00f,$dff180
  58.         move.w    #$fff,$dff180
  59.         move.w    #$f00,$dff180
  60.         sub.l    #1,d0
  61.         beq    ut
  62.         jmp    fladder(PC)
  63. ut        move.w    #0,$b00000
  64.         jmp    (a5)        ;Continue with reset from
  65.                     ;the place we jumped in.
  66. end
  67.  
  68. _DOSBase
  69. Dosname        DOSNAME
  70.  
  71. no_res        dc.b    'Unable to install myself! Read the docs!',10,13
  72.         dc.b    '(Are you out of CHIP-mem?)',10,13
  73.         
  74. no_res_end
  75.  
  76. res        dc.b    'Installed OK.',10,13
  77.         dc.b    'AdSpeed will now boot in 14MHz after reset.',10,13
  78. res_end
  79.  
  80.